extends "../calxsm_2_1/calxsm_2_1.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "丸将军"
	lv = 4
	addSkillTxt("[color=#FFFF00][百变魔法扇][/color][color=#FFCC22]复制随机一个友方亚比，如果处于魔力丸丸状态，则复制的亚比携带丸将军的装备[CD:16][/color]")  
	addCdSkill("bbmfs",16)

func _castCdSkill(id):
	._castCdSkill(id)
	if id=="bbmfs":
		var b = hasBuff("molww")
		if b != null:
			bbmfs()
		else:
			bbmfs1()

func bbmfs():
	var chas = getAllChas(2)
	chas.erase(self)
	if not chas.empty():
		var rndCha = sys.rndListItem(chas)
		var cha = summChara(rndCha.id, true)
		if cha.has_method("upgrade") and rndCha.get("upgraded") == true:
			cha.upgrade()
			cha.upgraded = true

func bbmfs1():
	var chas = getAllChas(2)
	chas.erase(self)
	if not chas.empty():
		var cha1
		var cha = utils.getRndAlly(2)
		if cha.has_method("summChara"):
			cha1 = cha.summChara(cha.id)